<jsp:directive.include file="/jsp/includes/taglibs.jsp" />
<script>
$().ready(function() { 
	
	$("#articleTable").dataTable({
		"bSort": true, 
		"bAutowidth" : true	,
		"bJQueryUI": true,
		"sPaginationType": "full_numbers"
		
	});
});

</script>
<div>
	<a href="<c:url value="/admin/news/edit"/>"><spring:message code="admin.news.link.new"/></a>
	<br/><br/>
</div>
<div>
	<table id="articleTable" class="dataTable" width="100%">
		<thead>
			<tr>
				<th><spring:message code="admin.news.id"/></th>
				<th><spring:message code="admin.news.title"/></th>
				<th><spring:message code="admin.news.lastUpdate"/></th>
				<th><spring:message code="admin.news.sourceDate"/></th>
				<th><spring:message code="admin.news.writer"/></th>
				<th><spring:message code="admin.news.owner"/></th>
				<th><spring:message code="admin.news.deleted"/></th>
			</tr>	
		</thead>
		<tbody>
			<c:forEach items="${ articles }" var="article">
				<tr>
					<td>
						<a href="<c:url value="/admin/news/edit"/>?id=${ article.id }">
							${ article.id }
						</a>
					</td>
					<td>						
						<a href="<c:url value="/admin/news/edit"/>?id=${ article.id }">
							${ article.title }
						</a></td>
					<td><fmt:formatDate type="both" value="${article.updateDate}"/></td>
					<td><fmt:formatDate type="both" value="${article.sourceDate}"/></td>
					<td>
						<a href="<c:url value="/user"/>/${ article.writer.name }">
							${ article.writer.name }
						</a>				
					</td>
					<td>
						<c:if test="${ !empty article.owner }">
							<a href="<c:url value="/user"/>/${ article.owner.name }">
								${ article.owner.name }
							</a>			
						</c:if>	
					</td>
					<td>
						<c:if test="${ article.deleted }">X</c:if>
					</td>				
				</tr>
			</c:forEach>
		</tbody>
	</table>
</div>